package com.sunwayhorizo.health.platform.security.service.dataInit;

import java.util.List;

import javax.ejb.Stateless;

import org.jboss.seam.annotations.Name;

import com.sunwayhorizo.health.business.dto.ResultsDTO;
import com.sunwayhorizo.health.common.ListUtil;
import com.sunwayhorizo.health.platform.base.BaseManager;

@Name("SecurityDataInitManager")
@Stateless
public class SecurityDataInitManager extends BaseManager implements SecurityDataInitManagerLocal{

    public ResultsDTO executeSQL(List<String> sqlList){
        for( int i=0;ListUtil.isNotEmpty(sqlList)&&i<sqlList.size();i++){
            super.entityManager2.createNativeQuery(sqlList.get(i)).executeUpdate();
        }
        super.flushClear(entityManager2);
        return getResultsDTO("执行成功", true, null);
    }
}
